<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$system_id = $system["system_id"];
$boss_id = $_GET["id"];

$sql = "select *, wm_instances.* from wm_bosses left join wm_instances on wm_bosses.boss_instance = wm_instances.instance_id where boss_id = $boss_id";
$res = $db->query($sql);
$boss = $db->fetch_assoc($res);

$_category = "warmath";
$_title = "Boss / " . $boss["boss_name"];
require('lib/head.php');

boxTop("Warmath: $_title");

?>

<b><?=$boss["boss_name"]?></b> in <a href="loot-instance.php?id=<?=$boss["instance_id"]?>"><?=$boss["instance_name"]?></a><br />
<a href="loot-boss.php?id=<?=$boss["boss_id"]?>"><?=$boss["boss_name"]?>'s Loot Table</a><br />
<br />
<b>DKP Value</b><br />
<?php
$sql = "select * from wm_boss_values where boss_value_boss = '" . $boss["boss_id"] . "' and boss_value_system_id = $system_id";

$ress = $db->query($sql);
$bval = $db->fetch_assoc($ress);
?>
<?=number_format($bval["boss_value_value"], 2)?> dkp<br />

<br />
<b>Wishes on Loot from this Boss</b><br />
<?php
$bid = $boss["boss_id"];

$sql = "select * from wm_characters left join wm_wishes on wm_wishes.wish_character = wm_characters.character_id left join wm_items on wm_wishes.wish_item = wm_items.item_id where item_boss = $bid and character_system_id = $system_id group by character_id order by character_dkp_satout desc";
$res = $db->query($sql);
?>
<i><?=$db->num_rows($res)?> characters.</i><br />
<?php
while($achar = $db->fetch_assoc($res)) {
?>
<?cclass($achar["character_class"])?> <a href="character.php?id=<?=$achar["character_id"]?>"><?=$achar["character_name"]?></a>
(<?=round($achar["character_dkp_satout"],2)?> satout dkp)<br />
<?php
}
?>
<br /><br />
<b>Credits</b><br />
<?php
$sql = "select *, wm_bosses.*, wm_raids.*, wm_instances.* from wm_credits left join wm_bosses on wm_bosses.boss_id = credit_boss left join wm_raids on wm_credits.credit_raid = wm_raids.raid_id left join wm_instances on wm_instances.instance_id = wm_raids.raid_instance where credit_system_id = $system_id and credit_boss = '" . $boss["boss_id"] . "'";
$result = $db->query($sql);
?>
<i><?=$db->num_rows($result)?> credits</i><br />
<?php
while($credit = $db->fetch_assoc($result)) {
?>
<a href="credit.php?id=<?=$credit["credit_id"]?>"><?=$credit["boss_name"]?>, <?=date("g:i a", strtotime($credit["credit_date"]))?></a> in <a href="raid.php?id=<?=$credit["raid_id"]?>"><?=$credit["instance_name"]?>, <?=date("D d M Y", strtotime($credit["raid_date"]))?></a><br />
<?php
    }
?>
<br />
<?php
boxBot();
?>

<?php
require('lib/foot.php');
?>

